import Vue from 'vue'
import Router from 'vue-router'
import VueRouter from 'vue-router'
Vue.use(Router)
const routes = [
    {
        path:'/',
        name:'Home',
        redirect:'/home'
    },
    {
        path:'/home',
        name:'Home',
        component:resolve=>require(['@/home'],resolve),
        //路由元信息
        meta:{},
        children:[
            {
                path:'/home',
                name:'Bloglist',
                meta:{index:1},
                component:resolve=>require(['@/view/bloglist'],resolve),
            },
            {
                path:'/detail',
                name:'Detail',
                meta:{},
                component:resolve=>require(['@/view/detail'],resolve),
            },
            {
                path:'/blogmanage',
                name:'Blogmanage',
                meta:{requiresAuth:true,index:7},
                component:resolve=>require(['@/view/blogManage'],resolve),
            },
            {
                path:'/source',
                name:'Source',
                meta:{requiresAuth:true,index:4},
                component:resolve=>require(['@/view/source'],resolve),
            },
            
            {
                path:'/personal',
                name:'Personal',
                meta:{requiresAuth:true,index:6},
                component:resolve=>require(['@/view/personal'],resolve),
            },
            {
                path:'/issue',
                name:'Issue',
                meta:{requiresAuth:true,index:2},
                component:resolve=>require(['@/view/issue'],resolve),
            },
            {
                path:'/updateSource',
                name:'updateSource',
                meta:{requiresAuth:true,index:5},
                component:resolve=>require(['@/view/updateSource'],resolve),
            },
        ]
    },
    
    {
        path:'/login',
        name:'Login',
        component:resolve=>require(['@/view/login'],resolve),
        //路由元信息
        meta:{},
    },
    {
        path:'/reg',
        name:'Reg',
        component:resolve=>require(['@/view/reg'],resolve),
        //路由元信息
        meta:{},
    }
]
const router = new VueRouter({
    mode:"history",
    base:process.env.BASE_URL,
    routes
})
export default router;